﻿<phone:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    x:Class="TestPhone.PlayerPage"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Landscape" Orientation="Landscape"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="False">

    <!--LayoutRoot 是包含所有页面内容的根网格-->
    <Grid x:Name="LayoutRoot" Background="Transparent" Loaded="LayoutRoot_Loaded" >
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <MediaElement  x:Name="MyPlayer" MediaFailed="MyPlayer_MediaFailed" MediaOpened="MyPlayer_MediaOpened" MediaEnded="MyPlayer_MediaEnded"   IsHitTestVisible="False" Stretch="Uniform" MarkerReached="MyPlayer_MarkerReached" Grid.RowSpan="3" AutoPlay="True"/>
        <Grid Grid.RowSpan="3" Grid.Row="0" Tap="Rectangle_Tap" Background="Transparent" Name="SubtitleGrid">
          
        </Grid>
        <Grid Height="80" Grid.Row="0" x:Name="HeadGrid">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Rectangle IsHitTestVisible="False" Grid.ColumnSpan="2" Stroke="Black" Opacity="0.245">
                <Rectangle.Fill>
                    <SolidColorBrush Color="{StaticResource PhoneTextBoxColor}"/>
                </Rectangle.Fill>
            </Rectangle>
            <ScrollViewer HorizontalContentAlignment="Left" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled">
                    <TextBlock HorizontalAlignment="Left" VerticalAlignment="Center" x:Name="txtTitle" FontSize="32" Margin="10,0"/>
            </ScrollViewer>
            <Image x:Name="btnPlay" Source="Play button.png" Tap="btnPlay_Tap" Grid.Column="1" Height="80" Width="80"/>
        </Grid>
        <Grid Grid.Row="2" x:Name="ControlGrid">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="200"/>
                <!--<ColumnDefinition Width="Auto"/>-->
            </Grid.ColumnDefinitions>
            <Rectangle IsHitTestVisible="False" Grid.ColumnSpan="1" Stroke="Black" Opacity="0.6" Fill="#BF000000"/>
            <Slider Grid.Column="0" x:Name="SeekProgress"  HorizontalAlignment="Stretch" Orientation="Horizontal" ManipulationCompleted="SeekProgress_ManipulationCompleted" VerticalAlignment="Center" Margin="0,10"  Style="{StaticResource SliderStyle1}" CacheMode="BitmapCache"/>
            <TextBlock Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" Text="0:00:00 / 0:00:00" Margin="15" x:Name="txtTimePosition"/>
            <Rectangle Grid.Column="1" Tap="Menu_Tap" Stroke="Black" Fill="Gray" Opacity="0.25"/>
            <TextBlock HorizontalAlignment="Right" TextWrapping="Wrap" Text="Menu" VerticalAlignment="Bottom" Grid.Column="1" FontSize="40" IsHitTestVisible="False" Margin="0,0,10,10"/>
           
        </Grid>
        <Grid Grid.Row="3" Visibility="Collapsed" x:Name="SettingGrid">
            <phone:Pivot x:Name="SettingPivot">
                <phone:PivotItem x:Name="SubSetting" Header="字幕选择">
                    <ScrollViewer>
                        <StackPanel VerticalAlignment="Top" Margin="0,0,0,20">
                            <TextBlock TextWrapping="Wrap" Text="选择字幕" HorizontalAlignment="Left" Margin="15,20,15,0" FontSize="26.667" VerticalAlignment="Top"/>
                            <toolkit:ListPicker VerticalAlignment="Top" x:Name="SubtitleSelect" DisplayMemberPath="Name"  SelectionChanged="SubtitleSelect_SelectionChanged" Margin="15,10,15,0"/>
                        </StackPanel>
                    </ScrollViewer>
                </phone:PivotItem>
                <phone:PivotItem x:Name="TrackSetting" Header="音轨选择">
                    <ScrollViewer>
                        <StackPanel VerticalAlignment="Top" Margin="0,0,0,20">
                            <CheckBox Content="静音" HorizontalAlignment="Left" VerticalAlignment="Top" IsChecked="{Binding IsMuted, ElementName=MyPlayer, Mode=TwoWay}" Margin="15,10,15,0" FontSize="26.667"/>
                            <TextBlock TextWrapping="Wrap" Text="选择音轨" HorizontalAlignment="Left" Margin="15,20,15,0" FontSize="26.667" VerticalAlignment="Top"/>
                            <toolkit:ListPicker VerticalAlignment="Top" x:Name="TrackSelect"  SelectionChanged="TrackSelect_SelectionChanged" Margin="15,10,15,0"/>
                        </StackPanel>
                    </ScrollViewer>
                </phone:PivotItem>
                <phone:PivotItem x:Name="PlaySetting" Header="其它设置">
                    <ScrollViewer>
                        <StackPanel VerticalAlignment="Top" Margin="0,0,0,20">
                            <TextBlock TextWrapping="Wrap" Text="视频大小" HorizontalAlignment="Left" Margin="15,20,15,0" FontSize="26.667" VerticalAlignment="Top"/>
                            <toolkit:ListPicker VerticalAlignment="Top" x:Name="VideoSizeSelect"  SelectionChanged="VideoSizeSelect_SelectionChanged" Margin="15,10,15,0">
                                <toolkit:ListPickerItem Content="保持比例" />
                                <toolkit:ListPickerItem Content="原始大小"/>
                                <toolkit:ListPickerItem Content="拉伸"/>

                            </toolkit:ListPicker>
                            <TextBlock HorizontalAlignment="Left" TextWrapping="Wrap" Text="Memory:" x:Name="txtMem" VerticalAlignment="Top" Grid.Column="1" Margin="15,20,15,0" FontSize="26.667" IsHitTestVisible="False"/>

                        </StackPanel>
                    </ScrollViewer>
                </phone:PivotItem>
            </phone:Pivot>
        </Grid>
    </Grid>

</phone:PhoneApplicationPage>